<?php
	include_once '../common_mbs.inc.php';
	include_once '../smarty.inc.php';
	$act  = $_INPUT['act'];
	if($act == 'loginu')
	{	
		$pwd  =$_INPUT['pwd'];
		$user = $_INPUT['user'];
		$check_code = $_INPUT['check_code'];
		if(empty($check_code) || empty($user) || empty($pwd) )
		{
			echo 1;
			exit;
		}
		if($_SESSION['login_code'] != strtoupper($check_code))
		{
			echo 2;
			exit;
		}
		$pwd = md5($pwd);
		$user_obj = new user_cls();
		$user_arr = $user_obj->get_user_list(false, "user_name = '{$user}' AND pwd = '{$pwd}'");
		if(empty($user_arr))
		{
			echo 1;
			exit;
		}
		if($user_arr[0]['user_status']== 0)
		{
			echo 3;
			exit;
		}
		//if($user_arr[])
		//初始化登录用户
		$_USER_ID = $user_arr[0]['user_id'];
		$_USER_NAME = $user_arr[0]['user_name'];
		$_USER_TYPE_ID = $user_arr[0]['user_type_id'];
		$_USER_PID = $user_arr[0]['pid'];
		$_USER_COMPANY = $user_arr[0]['company'];
		echo 99;
		exit;
		
	}
	

	$smarty->display('home/loginu.tpl');
?>
